package bite;

/**
 * Creared with IntelliJ IDEA.
 * Description:查找输入整数二进制中1的个数
 * 【查找输入整数二进制中1的个数】
 * 输入一个正整数，计算它在二进制下的1的个数。
 * User:yxd
 * Date:2022-04-29
 * Time:20:15
 */
import java.util.Scanner;
public class Day15_1 {
    public static void main1(String[] args) {
        Scanner input = new Scanner(System.in);
        while (input.hasNextInt()){
            int n = input.nextInt();
            String s = Integer.toBinaryString(n);
            int count = 0;
            for(int i = 0;i < s.length();i ++){
                if(s.charAt(i) == '1'){
                    count ++;
                }
            }
            System.out.println(count);
        }
    }

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        while (input.hasNextInt()) {
            int n = input.nextInt();
            int count = 0;
            while(n != 0){
                if((n & 1) == 1){//此二进制为为1
                    count ++;
                }
                n >>= 1;//n右移一位,不论是不是1
            }
            System.out.println(count);
        }
    }
}
